package com.example.evensystem.model.entity

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Entity
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.PrimaryKey
import androidx.room.Query
import androidx.room.Update
import java.sql.Date
import java.sql.Time

@Entity(tableName = "monthplan")
data class MonthPlan(
    //月份
    @PrimaryKey
    val month: String,//YYYY-MM
    //每日上班时间
    var arriveTime: String,
    //每日下班时间
    var leftTime: String,
    //每日工作时长（小时）
    var workHours: Int,
    //应工作天数
    var workDays: Int

)

@Dao
interface MonthPlanDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(monthPlan: MonthPlan)

    @Delete
    fun delete(monthPlan: MonthPlan)

    @Update
    fun update(monthPlan: MonthPlan)

    @Query("select * from monthplan where month=:month")
    fun find(month: String): List<MonthPlan>
}